#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    
    vector<vector<int>> arr(n, vector<int>(m));
    
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> arr[i][j];
        }
        sort(arr[i].begin(), arr[i].end());
    }
    
    for (int i = 0; i < n; ++i) {
        int max_win = 0;
        int min_win = 0;
        
        for (int j = 0; j < m; ++j) {
            int current = arr[i][j];
            bool can_win = true;
            bool cannot_win = true;
            
            for (int k = 0; k < n; ++k) {
                if (k == i) continue;
                
                if (arr[k][j] >= current) {
                    can_win = false;
                }
                
                if (arr[k][j] <= current) {
                    cannot_win = false;
                }
            }
            
            if (can_win) {
                max_win++;
            }
            
            if (cannot_win) {
                min_win++;
            }
        }
        
        cout << min_win << " " << max_win << endl;
    }
    
    return 0;
}
